Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
¿Cómo corregir automáticamente las importaciones de compilación de nodos que no tienen ".js" al final?

Tengo un proyecto personal usando node.js, express.js y mecanografiado.

Cuando ejecuto el comando para construir el proyecto, funciona bien.

Pero cuando trato de ejecutarlo, falla, porque todas las importaciones son "incorrectas", eche un vistazo:

El archivo dist/index.js tiene esta importación:

 import app from './core/app'; ...

PERO, si hago este cambio en la importación, funciona bien:

 import app from './core/app.js'; ...

No quería crear un archivo de script para hacer esto, ¿cómo puedo solucionarlo?

Actualmente estoy usando la versión de nodo 16.0.

Aquí está mi estructura de carpetas

ingrese la descripción de la imagen aquí

Aquí está mi index.ts

 import app from 'src/core/app'; /** * Initializing server */ app.listen(app.get('port'), () => console.log('Application running -> true'));

Aquí está mi tsconfig.json

 { "compilerOptions": { "lib": ["ES2021"], "target": "ES2021", "module": "ES2020", "moduleResolution": "node", "strict": true, "baseUrl": ".", "sourceMap": true, "outDir": "dist", "rootDir": "src", "skipLibCheck": true, "noImplicitAny": true, "esModuleInterop": true, "isolatedModules": true, "removeComments": true, "resolveJsonModule": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "useUnknownInCatchVariables": true, "allowSyntheticDefaultImports": true, "strictPropertyInitialization": false, "forceConsistentCasingInFileNames": true, "typeRoots": ["node_modules/@types", "src/@types"] }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"] }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!